﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Configuration;
using System.Data.SqlClient;

namespace _自用SqlHelper
{
    class Program
    {
        static void Main(string[] args)
        {
            string ConnString = ConfigurationManager.ConnectionStrings["SqlConn"].ToString();
            string sql = "insert into T_Person values(@Name,@Birthday,@Sex,@InputTime)";
            SqlParameter[] para = {
                new SqlParameter("@Name",SqlDbType.NVarChar,128) { Value="王五"},
                new SqlParameter("@Birthday",SqlDbType.DateTime) { Value=DateTime.Now.AddYears(-18) },
                new SqlParameter("@Sex",SqlDbType.NVarChar,2) { Value="男"},
                new SqlParameter("@InputTime",SqlDbType.DateTime) { Value=DateTime.Now}
            };
            int i = SqlHelper.ExecuteNonQuery(ConnString, sql, CommandType.Text, para);
            Console.WriteLine(i);
            Console.ReadKey();
        }
    }
}
